package com.example.test.forward_result;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;

import androidx.annotation.Nullable;

public class PostActivity extends Activity implements View.OnClickListener {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        LinearLayout layout = new LinearLayout(this);
        Button button = new Button(this);
        button.setText("PostActivity send Result");
        button.setOnClickListener(this);
        layout.addView(button);
        setContentView(layout);
    }


    @Override
    public void onClick(View v) {
        Intent data = new Intent();
        data.setType("ok");
        setResult(RESULT_OK, data);
        finish();
    }
}
